//
//  FD_Method.h
//  zhaofang
//
//  Created by 黄卫 on 17/2/24.
//  Copyright © 2017年 huangwei. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#pragma mark - =====常用正则表达式=====
/** 只能输入字符与数字*/
#define GJRegularNumberALetter              (@"^[A-Za-z0-9]+$")

typedef void(^pushViewControlCallBackBlock)(id viewControl);

/** 筛选条件回调*/
typedef BOOL(^filterConditionBlock)(id conditon,id compare);

/** 属性字符串处理*/
typedef void(^beginEditingBlock)(NSMutableAttributedString *attrString);


/** 日志打印*/
#define FD_NSLogInfo(description,error) (NSLog(@"%s %@ %@",__FUNCTION__,description,error))
#define FD_COLOR_WITH_RGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#define PLUIFont(size) (FontCustomSize(size))


@class FD_UserSceneModel;

@interface FD_Method : NSObject
#pragma mark - =====字符串处理=====
/** 返回字符串Size*/
+(CGSize)stringSize:(NSString *)string andFont:(UIFont *)fontsize andwidth:(CGFloat)numsize;

/** 去掉字符串空格*/
+(NSString *)stringReplaceNull:(NSString *)string;

/** 字典转JSON字符串*/
+(NSString*)dictionaryToJson:(NSDictionary *)dic;
/** JSON字符串转字典*/
+ (NSDictionary *)jsonStringWithDictionary:(NSString *)jsonString;

+(NSAttributedString *)setAttrStringWithString:(NSString *)string handSetBlock:(beginEditingBlock)block;


#pragma mark - =====本地通知=====
/** 注册本地通知*/
+(void)registerLocalNotificationWithAlertBody:(NSString *)alertbody AdNotiUserInfo:(NSDictionary *)userInfo;
/** 取消本地通知*/
+(void)cancelLocalNotificationForKey:(NSString *)notiKey;

#pragma mark - =====多线程=====
/** 创建同步线程——InvocationOperation方式*/
+(void)createSynOperationForSEL:(SEL)method;
/** 创建异步线程——BlockOperation方式*/
+(void)createUSynOperationForCallBlock:(void(^)(void))threadBlock, ... NS_REQUIRES_NIL_TERMINATION;
/** 创建异步线程——OperationQueue方式*/
+(void)createUSynOperationQueueForCallBlock:(void(^)(void))threadBlock, ... NS_REQUIRES_NIL_TERMINATION;

#pragma mark - =====实体模型相关=====
/** 实体模型转字典*/
+(NSDictionary *)entityModelToDictionary:(id)entity AdRemoveString:(NSString *)string;
/** 指定生成模型字典*/
+(NSDictionary *)entityModelToDictionary:(id)entity AdNeedKeyArr:(NSArray <NSString *> *)key;

/** 某个类是否存在某个属性*/
+ (BOOL)getVariableWithClass:(id)myClass varName:(NSString *)name;


#pragma mark - =====WIFI网络相关=====
/** 解析域名获取IP地址*/
+(NSString *)getIPWithHostName:(const NSString *)hostName;
/** 网络状态
 0：无网络
 1：WIFI网络
 2：2G/3G/4G网络
 */
+(NSString *)getNetworkState;
/** 获取网卡相关信息*/
+(NSDictionary *)getWIFIDic;
/** 获取网卡IP地址*/
+ (NSString *)localIPAddress;
/** 获取网卡BSSID*/
+(NSString *)getBSSID;
/** 获取网卡SSID*/
+(NSString *)getSSID;


#pragma mark - =====加密功能相关=====
/** MD5加密*/
+ (NSString *)getMd5:(NSString *)passWord;


#pragma mark - =====UI相关=====
+(UIView *)customButtonViewWithFrame:(CGRect)rect AddContainer:(UIView *)container AdActionTarget:(id)obj Action:(SEL)action;
/**
 ** lineView:       需要绘制成虚线的view
 ** lineLength:     虚线的宽度
 ** lineSpacing:    虚线的间距
 ** lineColor:      虚线的颜色
 **/
+(void)drawDashLine:(UIView *)lineView lineLength:(int)lineLength lineSpacing:(int)lineSpacing lineColor:(UIColor *)lineColor;

#pragma mark - =====条件筛选方法======
+(NSArray *)filterWithSoure:(NSArray *)soureArr AdCondition:(filterConditionBlock)block;


#pragma mark - =====页面选项跳转相关=====
/** 装载实体模型*/
+(NSArray *)loadModelWithModelClass:(NSString *)modelClass AdLoadSEL:(NSString *)methodSEL AdDataSoure:(NSArray *)dictArr;
/** 处理页面跳转*/
+(void)handPushViewControlWithClass:(NSString *)viewControl AdNavigation:(UINavigationController *)navControl compleBlcok:(pushViewControlCallBackBlock)block;

+(void)presentNavBarStyle;
+(void)dismissRestoreNavBarStyle;


#pragma mark - RunTime
/**  打印该类所有属性*/
+(void)getClassInfoLogWith:(Class)objeClass;

#pragma mark - 文件上传服务器
/** 文件上传*/
+(void)postUploadFileWithUrl:(NSString *)url  postParems:(NSDictionary *)parems fileSoureData:(NSArray *)fileData;


#pragma mark - =====其它=====
/** 提示框*/
+(void)showAlertView:(NSString *)description;
+ (UIImage *)thumbnailForAsset:(NSData *)asset maxPixelSize:(NSUInteger)size;
/** 摄像头是否可用*/
+(BOOL)isCameraAvailable;
/** 相册是否可用*/
+(BOOL)isPhotoLibraryAvailable;
/** 处理图片方向*/
+(UIImage *)handImageWithOrientation:(UIImageOrientation)orientation WithImage:(UIImage *)soureImagew;
/** 生成图片*/
+ (UIImage *)makeImageWithView:(UIView *)view withSize:(CGSize)size;

/** 只能输入数字*/
+ (BOOL)validateNumber:(NSString*)number;
/** 是否匹配输入约定字符*/
+(BOOL)validateParamter:(NSString *)paramter AdCodeString:(NSString *)codeString;
/** 正则匹配字符串*/
+(BOOL)regularValidateParamter:(NSString *)paramter AdRegular:(NSString *)regular;

/** 当前年月日*/
+(NSString *)curentDateTime;
/** 当前完整时间*/
+(NSString *)curentCompleteDate;

/** 获取去年相关时间*/
+(NSString *)lastYearDateTimeWithDate:(NSDate *)date;
/** 获取过去相关时间*/
+(NSString *)getLastTimeWith:(CGFloat)year lastMoth:(CGFloat)moth lastDay:(CGFloat)day;
/** 获取当前时间月份的天数*/
+(NSInteger)getCurenDateMothDays:(NSDate *)date;
/**
 *  获取本月第一天和最后一天
 */
+ (NSArray *)getMonthBeginAndEndDay;



/** 获取当前时间去年的时间*/
+(NSDate *)getLastYearDate;
/** 是否在某个时间段内*/
+(BOOL)validateWithDate:(NSDate *)compareDate StartTime:(NSString *)startTime withExpireTime:(NSString *)expireTime;
/** 过滤emoj表情*/
+(NSString *)disableEmoji:(NSString *)text;
/** 中文转拼音*/
char pinyinFirstLetter(unsigned short hanzi);

@end
